package com.cq.hd.member.api;

import com.cq.hd.common.pagination.Page;
import com.cq.hd.common.response.Result;
import com.cq.hd.member.api.dto.*;
import com.cq.hd.member.api.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "hd-o2o-member-service", contextId = "business-api")
public interface TbBusinessApi {

    // 列表
    @GetMapping("/member/business/pageBusiness")
    Result<Page<BusinessPageVo>> pageBusiness(@SpringQueryMap BusinessPageDto businessPageDto);

    // 详情
    @GetMapping("/member/business/details")
    Result<AdminBusinessPageVo> details(@RequestParam("id") Long id);

    // 商家邀请商户/经纪人
    @PostMapping("/member/business/invite")
    Result<InviteMerchantVo> invite(@RequestBody BusinessInviteDto businessInviteDto);

    // 商家解绑商户
    @PostMapping("/member/business/unBindMerchant")
    Result<Boolean> unBindMerchant(@RequestBody BusinessMerchantUnBindDto businessMerchantUnBindDto);

    // 分页关联商户列表
    @GetMapping("/member/merchant/pageRelationMerchant")
    Result<Page<RelationMerchantPageVo>> pageRelationMerchant(@SpringQueryMap RelationMerchantPageDto relationMerchantPageDto);

    // 关联商户id列表
    @GetMapping("/member/merchant/listRelationMerchantId")
    Result<List<Long>> listRelationMerchantId(@RequestParam("userId") Long userId, @RequestParam("businessId") Long businessId);

    // 根据用户id获取商家信息
    @GetMapping("/member/business/getByUserId")
    Result<BusinessPageVo> getByUserId(@RequestParam("userId") Long userId);

    // 商家主页
    @GetMapping("/member/business/getHomePage")
    Result<BusinessHomePageVo> getHomePage(@RequestParam("id") Long id, @RequestParam("userId") Long userId);

    // 更新商家主页
    @PutMapping("/member/business/updateHomePage")
    Result<Boolean> updateHomePage(@RequestBody UpdateHomePageDto updateHomePageDto);

    // 分享商家主页
    @PostMapping("/member/business/shareHomePage")
    Result<BusinessShareVo> shareHomePage(@RequestBody BusinessShareDto businessShareDto);

    // 根据手机号获取商家信息
    @GetMapping("/member/business/getByMobile")
    Result<BusinessPageVo> getByMobile(@RequestParam("mobile") String mobile);

    // 根据id批量查询商家数据
    @PostMapping("/member/business/listByIds")
    Result<List<BusinessVo>> listByIds(@RequestBody List<Long> businessIds);

    // 根据商家名称分页搜索商家数据
    @GetMapping("/member/business/searchByBusinessName")
    Result<Page<BusinessVo>> searchByBusinessName(@RequestParam("pageNum") Integer pageNum,
                                                  @RequestParam("pageSize") Integer pageSize,
                                                  @RequestParam("keyword") String keyword);

    // 获取活动发布次数
    @GetMapping("/member/business/getActiveCount")
    Result<BusinessVo> getActiveCount(@RequestParam("userId") Long userId, @RequestParam("businessId") Long businessId);

    // 扣减商家发布活动个数
    @PostMapping("/member/business/subActiveCount")
    Result<Boolean> subActiveCount(@RequestBody UpdateActiveCountDto updateActiveCountDto);

    // 扫描商家会员是否过期
    @PostMapping("/member/business/scanBusinessMemberExpireJob")
    Result<Boolean> scanBusinessMemberExpireJob();

    // 根据邀请码获取商家数据
    @GetMapping("/member/business/getByInviteCode")
    Result<BusinessPageVo> getByInviteCode(@RequestParam("inviteCode") String inviteCode);

    // 根据日期查询新入驻的商家数
    @GetMapping("/member/business/getNewCountByDate")
    Result<Integer> getNewCountByDate(@RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);

    // 根据商家id获取商家数据
    @GetMapping("/member/business/getById")
    Result<BusinessPageVo> getById(@RequestParam("businessId") Long businessId);

    // 批量获取商家详情数据
    @PostMapping("/member/business/listDetailByIds")
    Result<List<BusinessDetailVo>> listDetailByIds(@RequestBody List<Long> businessIds);

    // 扣减商家补贴金余额+增加商家补贴金流水（两条，一条是补贴扣除，一条是营销补贴服务费）
    @PostMapping("/member/business/subSubsidyAmt")
    Result<Boolean> subSubsidyAmt(@RequestBody BusinessSubSubsidyAmtDto businessSubSubsidyAmtDto);

    // 扫描 结算池商家 对 普通商户 的待转账记录，扣减商家补贴余额，如果扣减成功，另一个任务回去定时进行汇付余额转账
    @PostMapping("/member/business/scanSubsidyWaitPayJob")
    Result<Boolean> scanSubsidyWaitPayJob();

    // 扫描 结算池商家 对 普通商户 的待转账记录，扣减商家补贴余额，如果扣减成功，另一个任务回去定时进行汇付余额转账
    @PostMapping("/member/business/scanSubsidyWaitTransferJob")
    Result<Boolean> scanSubsidyWaitTransferJob();

    // 商家分享海报是否展示商家头像开关
    @PostMapping("/member/business/updatePosterShowAvatarState")
    Result<Integer> updatePosterShowAvatarState(@RequestParam("businessId") Long businessId, @RequestParam("posterShowAvatarState") Integer posterShowAvatarState);
}
